home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Jotto ][ 1.2 / source / Jotto code ƒ / jotto graphics.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  2.0 KB  |  86 lines  |  [TEXT/MMCC]

  1. #include "jotto graphics.h"
  2. #include "program globals.h"
  3. #include "util.h"
  4. #include "window layer.h"
  5.  
  6. void DrawWordInList(WindowPtr theWindow)
  7. {
  8.     Str255            tempStr;
  9.  
  10.     TextFont(monaco);
  11.     TextSize(9);
  12.     TextMode(srcXor);
  13.     
  14.     MoveTo(20+(GetWindowWidth(theWindow))/2-4*CharWidth(' '),105+gNumTries*12);
  15.     Mymemcpy((Ptr)((long)tempStr+1), gHumanWord[gNumTries], gNumLetters);
  16.     tempStr[0]=gNumLetters;
  17.     DrawString(tempStr);
  18.     DrawString("\p    ");
  19.     NumToString(gNumRight[gNumTries], tempStr);
  20.     DrawChar(tempStr[1]);
  21. }
  22.  
  23. void DrawOneChar(WindowPtr theWindow)
  24. {
  25.     Rect            theRect;
  26.     char            thisChar;
  27.     
  28.     TextFont(144);
  29.     TextSize(24);
  30.     TextMode(srcXor);
  31.     theRect.top=32;
  32.     theRect.bottom=theRect.top+36;
  33.     theRect.left=(GetWindowWidth(theWindow))/2-98-((gNumLetters==6) ? 20 : 0)+40*gWhichChar;
  34.     theRect.right=theRect.left+36;
  35.     FillRect(&theRect, &qd.black);
  36.     thisChar=gHumanWord[gNumTries][gWhichChar];
  37.     MoveTo((GetWindowWidth(theWindow))/2-80-((gNumLetters==6) ? 20 : 0)+
  38.         gWhichChar*40-CharWidth(thisChar)/2, (thisChar=='Q') ? 59 : 61);
  39.     DrawChar(thisChar);
  40. }
  41.  
  42. void DrawCurrentWord(WindowPtr theWindow)
  43. {
  44.     short            j;
  45.     Rect            theRect;
  46.     char            thisChar;
  47.  
  48.     TextFont(144);
  49.     TextSize(24);
  50.     TextMode(srcXor);
  51.     theRect.top=31;
  52.     theRect.bottom=theRect.top+38;
  53.     theRect.left=(GetWindowWidth(theWindow))/2-99-((gNumLetters==6) ? 20 : 0);
  54.     theRect.right=theRect.left+38;
  55.     for (j=0; j<gNumLetters; j++)
  56.     {
  57.         FillRect(&theRect, &qd.black);
  58.         ForeColor(whiteColor);
  59.         FrameRect(&theRect);
  60.         ForeColor(blackColor);
  61.         theRect.left+=40;
  62.         theRect.right+=40;
  63.     }
  64.     
  65.     for (j=0; j<gNumLetters; j++)
  66.     {
  67.         thisChar=gHumanWord[gNumTries][j];
  68.         MoveTo((GetWindowWidth(theWindow))/2-80-((gNumLetters==6) ? 20 : 0)+j*40-CharWidth(thisChar)/2,
  69.             (thisChar=='Q') ? 59 : 61);
  70.         DrawChar(thisChar);
  71.     }
  72.     TextFont(monaco);
  73.     TextSize(9);
  74. }
  75.  
  76. void HighlightChar(WindowPtr theWindow)
  77. {
  78.     Rect            theRect;
  79.     
  80.     theRect.top=32;
  81.     theRect.bottom=theRect.top+36;
  82.     theRect.left=(GetWindowWidth(theWindow))/2-98-((gNumLetters==6) ? 20 : 0)+40*gWhichChar;
  83.     theRect.right=theRect.left+36;
  84.     InvertRect(&theRect);
  85. }
  86.